package stdio.costa.imoca.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import stdio.costa.imoca.utils.LangUtils;

@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Address extends UuidEntity implements Serializable {

	private static final long serialVersionUID = -6823986102615804451L;

	private String whom;

	private String postcode;

	private String province;

	private String city;

	private String district;

	private String detail;

	public Address() {
	}

	public Address(String whom, String postcode, String province, String city, String district, String detail) {
		this.whom = whom;
		this.postcode = postcode;
		this.province = province;
		this.city = city;
		this.district = district;
		this.detail = detail;
	}

	public boolean hasBeenCompleted() {
		return !LangUtils.containsBlank(whom, postcode, detail) && LangUtils.containsNonBlank(province, city);
	}
	
	public String getPostcode() {
		return postcode;
	}

	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	public String getWhom() {
		return whom;
	}

	public void setWhom(String whom) {
		this.whom = whom;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}
}
